package com.feihao.zhou.ThreadSaveDemo3;

import java.util.concurrent.locks.ReentrantLock;

public class TestDemo {
    public static void main(String[] args) {
        //创建Desk对象，设置初始属性：
        Desk desk = new Desk(10,false);

        //创建吃货对象：将desk对象传入
        ChiHuo chiHuo = new ChiHuo(desk);
        //创建厨师对象，将desk对象传入
        Cooker cooker = new Cooker(desk);

        //创建线程对象：传入吃货、厨师对象：
        Thread t1 = new Thread(chiHuo);
        Thread t2 = new Thread(cooker);

        //开启线程：
        t1.start();
        t2.start();
    }
}













































       /* //创建桌子对象：
        Desk desk = new Desk();
        desk.setLock(new ReentrantLock());

        //创建厨师对象：
        Cooker cooker = new Cooker(desk);

        //创建吃货对象：
        ChiHuo chiHuo = new ChiHuo(desk);

        Thread thread = new Thread(cooker);
        Thread thread1 = new Thread(chiHuo);

        thread.start();
        thread1.start();

    }
}*/
